package com.habdqn.easybuy.web.manage.product.category;

import com.habdqn.easybuy.entity.ProductCategory;
import com.habdqn.easybuy.service.impl.ProductCategoryServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author Xing.Jiejian
 * @date 2020/11/30
 */
@WebServlet(name = "ProductCategoryListServlet",urlPatterns = "/manage/product/category")
public class ListServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<ProductCategory> categories = new ProductCategoryServiceImpl().queryAll();
        request.setAttribute("categories",categories);
        request.getRequestDispatcher("/WEB-INF/manage/product/category.jsp").forward(request,response);
    }
}
